<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    
    <title>在Java中如何使用正则表达式 | 博客主页 | 世界是个球，前方总有路！</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="JavaSE">
    <meta name="description" content="前言&amp;emsp;&amp;emsp;最近放寒假了，时间比较多，终于有时间继续研究Java的基础知识。这几天在看《Java编程思想》这本书，刚好看完了正则表达式这一张章节，写一遍博客记录以下，防止忘记（虽然还是会忘记）。   介绍什么是正则表达式？&amp;emsp;&amp;emsp;正则表达式(Regular Expression)是一种文本模式，包括普通字符（例如，a 到 z 之间的字母）和特殊字符（称为”元字符”）">
<meta property="og:type" content="article">
<meta property="og:title" content="在Java中如何使用正则表达式">
<meta property="og:url" content="http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/index.html">
<meta property="og:site_name" content="博客主页">
<meta property="og:description" content="前言&amp;emsp;&amp;emsp;最近放寒假了，时间比较多，终于有时间继续研究Java的基础知识。这几天在看《Java编程思想》这本书，刚好看完了正则表达式这一张章节，写一遍博客记录以下，防止忘记（虽然还是会忘记）。   介绍什么是正则表达式？&amp;emsp;&amp;emsp;正则表达式(Regular Expression)是一种文本模式，包括普通字符（例如，a 到 z 之间的字母）和特殊字符（称为”元字符”）">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-01-09T13:52:41.000Z">
<meta property="article:modified_time" content="2020-01-09T16:09:38.540Z">
<meta property="article:author" content="特务依昂">
<meta property="article:tag" content="JavaSE">
<meta name="twitter:card" content="summary">
    
        <link rel="alternate" type="application/atom+xml" title="博客主页" href="/blog/atom.xml">
    
    <link rel="shortcut icon" href="/blog/img/title.png">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

<meta name="generator" content="Hexo 4.2.0"></head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/blog/img/brand.jpg)">
      <div class="brand">
        <a href="/blog/" class="avatar waves-effect waves-circle waves-light">
          <img src="/blog/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">特务依昂</h5>
          <a href="mailto:1131564805@qq.com" title="1131564805@qq.com" class="mail">1131564805@qq.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/blog/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                博客
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                标签
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/categories"  >
                <i class="icon icon-lg icon-th-list"></i>
                分类
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/tewuyiang" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://weibo.com/u/5516635708/" target="_blank" >
                <i class="icon icon-lg icon-weibo"></i>
                Weibo
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://www.cnblogs.com/tuyang1129/" target="_blank" >
                <i class="icon icon-lg icon-link"></i>
                博客园
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">在Java中如何使用正则表达式</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">在Java中如何使用正则表达式</h1>
        <h5 class="subtitle">
            
                <time datetime="2020-01-09T13:52:41.000Z" itemprop="datePublished" class="page-time">
  2020-01-09
</time>


	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/blog/categories/JavaSE/">JavaSE</a></li></ul>

            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap post-toc-shrink" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#前言"><span class="post-toc-number">1.</span> <span class="post-toc-text">前言</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#介绍"><span class="post-toc-number">2.</span> <span class="post-toc-text">介绍</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#什么是正则表达式？"><span class="post-toc-number">2.1.</span> <span class="post-toc-text">什么是正则表达式？</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#在Java中如何使用正则表达式？"><span class="post-toc-number">2.2.</span> <span class="post-toc-text">在Java中如何使用正则表达式？</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Pattern类"><span class="post-toc-number">2.2.1.</span> <span class="post-toc-text">Pattern类</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Matcher类"><span class="post-toc-number">2.2.2.</span> <span class="post-toc-text">Matcher类</span></a></li></ol></li></ol></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#代码"><span class="post-toc-number">3.</span> <span class="post-toc-text">代码</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#正则表达式小demo"><span class="post-toc-number">3.1.</span> <span class="post-toc-text">正则表达式小demo</span></a></li></ol></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#总结"><span class="post-toc-number">4.</span> <span class="post-toc-text">总结</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#参考"><span class="post-toc-number">5.</span> <span class="post-toc-text">参考</span></a></li></ol>
        </nav>
    </aside>


<article id="post-在Java中如何使用正则表达式"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">在Java中如何使用正则表达式</h1>
        <div class="post-meta">
            <time class="post-time" title="2020-01-09 21:52:41" datetime="2020-01-09T13:52:41.000Z"  itemprop="datePublished">2020-01-09</time>

            
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/blog/categories/JavaSE/">JavaSE</a></li></ul>



            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style='display:none'>
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>&emsp;&emsp;最近放寒假了，时间比较多，终于有时间继续研究Java的基础知识。这几天在看《Java编程思想》这本书，刚好看完了<strong>正则表达式</strong>这一张章节，写一遍博客记录以下，防止忘记<font color='gray'>（虽然还是会忘记）</font>。</p>
<br>

<h2 id="介绍"><a href="#介绍" class="headerlink" title="介绍"></a>介绍</h2><h3 id="什么是正则表达式？"><a href="#什么是正则表达式？" class="headerlink" title="什么是正则表达式？"></a>什么是正则表达式？</h3><p>&emsp;&emsp;正则表达式(Regular Expression)是一种文本模式，包括普通字符（例如，a 到 z 之间的字母）和特殊字符（称为”元字符”）。正则表达式使用<code>单个字符串</code>来<strong>描述、匹配</strong>一系列符合某个句法规则的字符串（CV大法）。</p>
<p>&emsp;&emsp;说白了，正则表达式就是<strong>定义字符串的规则</strong>。我们使用正则表达式，为字符串定义一个规则，比如我们定义一个正则表达式，表示一个只由数字组成，长度任意的字符串，然后，我们就可以用这个正则表达式去匹配任意字符串，看这个字符串是否匹配这个规则。</p>
<br>

<h3 id="在Java中如何使用正则表达式？"><a href="#在Java中如何使用正则表达式？" class="headerlink" title="在Java中如何使用正则表达式？"></a>在Java中如何使用正则表达式？</h3><p>&emsp;&emsp;正则表达式的语法我这里就不提了，太多太杂，不会的可以去<a href="https://www.runoob.com/regexp/regexp-tutorial.html" target="_blank" rel="noopener" title="正则表达式">菜鸟教程</a>看看，我这里主要就是写写在Java中如何使用正则表达式。</p>
<p>&emsp;&emsp;在Java中使用正则表达式，首先得知道两个类，一个叫做<strong>Pattern</strong>，一个叫做<strong>Matcher</strong>，这两个类都是<strong>java.util.regex</strong>包下的，这个包下也就这两个类。</p>
<h4 id="Pattern类"><a href="#Pattern类" class="headerlink" title="Pattern类"></a>Pattern类</h4><p>&emsp;&emsp;<code>Pattern</code>类是用来干嘛的呢，其实我们可以把他简单理解为就是一个正则表达式（就像File类一样，我们可以简单理解为它就是一个文件）。Pattern类没有公共的构造方法，这意味着我们不能直接<code>new</code>一个<code>Pattern</code>类的对象。在这个类中，提供了一个方法，名字叫<code>compile</code>，我们将正则表达式作为参数，传入这个方法中，就可以得到一个<code>Pattern</code>对象，我们可以将这个对象理解为就是传入的正则表达式。</p>
<p>&emsp;&emsp;<code>Pattern</code>类有一个实例方法，叫做matcher，这个方法接收一个参数，就是<strong>需要匹配的字符串</strong>，方法的返回值就是一个Mather对象。</p>
<h4 id="Matcher类"><a href="#Matcher类" class="headerlink" title="Matcher类"></a>Matcher类</h4><p>&emsp;&emsp;<code>Matcher</code>类又是用来干嘛的呢？<code>Matcher</code>这个单词翻译过来就是<strong>匹配器</strong>的意思，一个<code>Matcher</code>对象就是一个匹配器，我们通过这个匹配器，就可以<strong>操作正则表达式与字符串的匹配过程</strong>。操作的是哪个正则表达式和字符串呢？就是我们调用<code>Pettern</code>类的<code>compile</code>方法生成的<code>Pettern</code>对象，以及调用<code>Pettern</code>对象的<code>matcher</code>方法传入的要匹配的字符串。通过这个匹配器对象，我们可以控制字符串的匹配，查看匹配结果，甚至可以替换等便利的操作。</p>
<br>

<h2 id="代码"><a href="#代码" class="headerlink" title="代码"></a>代码</h2><h3 id="正则表达式小demo"><a href="#正则表达式小demo" class="headerlink" title="正则表达式小demo"></a>正则表达式小demo</h3><p>&emsp;&emsp;下面我们看一个简单的小demo：<strong>使用正则表达式，匹配字符串中所有数字部分，输出匹配的部分，以及匹配的部分在原字符串中的位置</strong>。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> FileNotFoundException </span>&#123;</span><br><span class="line">		</span><br><span class="line">    <span class="comment">// 使用Pattern类的compile方法，传入一个正则表达式，得到一个Pattern对象</span></span><br><span class="line">    Pattern pattern = Pattern.compile(<span class="string">"[0-9]+"</span>);</span><br><span class="line">    <span class="comment">// 调用pattern对象的matcher方法，传入需要匹配的字符串， 得到一个匹配器对象</span></span><br><span class="line">    Matcher matcher = pattern.matcher(<span class="string">"abcd123acca123a1a2"</span>);</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 从字符串开头，逐一向后匹配，直到无法再匹配为止</span></span><br><span class="line">    <span class="keyword">while</span>(matcher.find()) &#123;</span><br><span class="line">        <span class="comment">// 输出上一次匹配的内容</span></span><br><span class="line">        System.out.print(matcher.group() + <span class="string">":  "</span>);</span><br><span class="line">        <span class="comment">// 输出上一次匹配的首尾索引</span></span><br><span class="line">        System.out.println(matcher.start() + <span class="string">"-&gt;"</span> + (matcher.end()-<span class="number">1</span>) );</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>&emsp;&emsp;上面的代码首先使用<code>Pattern</code>类的<code>compile</code>方法，传入一个正则表达式，得到一个<code>Pattern</code>对象，<strong>[0-9]+</strong>这个表达式的意思就是任意长度，且仅由<code>0-9</code>组成的字符串。得到<code>Pattern</code>对象后，调用它的<code>matcher</code>方法，传入需要匹配的字符串，即可得到一个匹配器，也就是<code>Matcher</code>对象。</p>
<p>&emsp;&emsp;得到这个<code>Matcher</code>对象后，就可以进行匹配操作了。在上面的代码中，调用了<code>find</code>方法进行匹配。find方法的作用就是尝试从字符串中找到<strong>下一个</strong>匹配正则表达式的部分，若匹配成功，就返回true，否则返回false，而已经匹配的部分会被跳过。<code>Matcher</code>对象的<code>group()</code>方法返回上一次匹配的部分，而<code>start()</code>方法返回上一次匹配部分的开始索引，<code>end()</code>方法返回上一次匹配部分的<strong>结束索引+1</strong>的值。我们在while循环的条件中调用<code>find</code>方法进行匹配，若匹配成功，则输出上次匹配的部分，以及匹配部分在原字符串中的位置。例如上面的代码，输出结果如下：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">123</span>:  <span class="number">4</span>-&gt;<span class="number">6</span></span><br><span class="line"><span class="number">123</span>:  <span class="number">11</span>-&gt;<span class="number">13</span></span><br><span class="line"><span class="number">1</span>:  <span class="number">15</span>-&gt;<span class="number">15</span></span><br><span class="line"><span class="number">2</span>:  <span class="number">17</span>-&gt;<span class="number">17</span></span><br></pre></td></tr></table></figure>

<br>

<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>&emsp;&emsp;上面描述了<code>Pattern</code>和<code>Matcher</code>类最基本的操作，但是这两个类的作用远不止如此，它们还可以进行很多方便的操作，比如替换操作等，但是这里就不一一描述了，有时间再慢慢补充。</p>
<br>

<h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2><p>《Java编程思想》</p>

        </div>

        <blockquote class="post-copyright">
    
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2020-01-09T16:09:38.540Z" itemprop="dateUpdated">2020-01-10 00:09:38</time>
</span><br>


        
        世界是个球，前方总有路！
        
    </div>
    
    <footer>
        <a href="http://tewuyiang.gitee.io/blog">
            <img src="/blog/img/avatar.jpg" alt="特务依昂">
            特务依昂
        </a>
    </footer>
</blockquote>

        


        <div class="post-footer">
            
	<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/JavaSE/" rel="tag">JavaSE</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/&title=《在Java中如何使用正则表达式》 — 博客主页&pic=http://tewuyiang.gitee.io/blog/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/&title=《在Java中如何使用正则表达式》 — 博客主页&source=一个未来程序员的博客~~~" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《在Java中如何使用正则表达式》 — 博客主页&url=http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/&via=http://tewuyiang.gitee.io/blog" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/blog/%E5%A6%82%E4%BD%95%E5%8E%BB%E9%99%A4%E9%93%BE%E8%A1%A8%E4%B8%AD%E5%80%BC%E9%87%8D%E5%A4%8D%E7%9A%84%E8%8A%82%E7%82%B9/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">如何去除链表中值重复的节点</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/blog/Java%E5%AE%9E%E7%8E%B0%E5%A0%86%E6%8E%92%E5%BA%8F/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">Java实现堆排序</h4>
      </a>
    </div>
  
</nav>



    




















</article>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/blog/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>特务依昂 &copy; 2015 - 2020</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/&title=《在Java中如何使用正则表达式》 — 博客主页&pic=http://tewuyiang.gitee.io/blog/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/&title=《在Java中如何使用正则表达式》 — 博客主页&source=一个未来程序员的博客~~~" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《在Java中如何使用正则表达式》 — 博客主页&url=http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/&via=http://tewuyiang.gitee.io/blog" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://tewuyiang.gitee.io/blog/%E5%9C%A8Java%E4%B8%AD%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/blog/', SHARE: true, REWARD: false };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>






<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>



<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '人呢，怎么不见了！';
            clearTimeout(titleTime);
        } else {
            document.title = '(つェ⊂)咦!欢迎回来!';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
